import { useState,useEffect }from "react"; 
import { useParams } from "react-router-dom";
export default function Cateagory() {
    console.log( useState(0));
    let [count,setCount] = useState(0);
    let [arr,setArr] = useState([1,2,3]);
    let [obj,setObj]=useState({uname:'张三'})
    function add() {
        count++;
        setCount(count)
    }
        function push() {
            arr.push(4); 
            setArr([...arr]);
        }
        function changUname() {
            obj.uname='李四'
            setObj({...obj})
            // steObj({uname:'李四'})
        }
        var params = useParams();
        var [data,setData]=useState({});
        useEffect(() => {
         console.log(params.id);  
        });
            return <div >
    <p onClick={add}>{count}</p>
    <p onClick={push}>{arr}</p>
    <p onClick={changUname}>{obj.uname}</p>

    </div >
}